home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 5.00 Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX" Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0"; "COMCTL32.OCX" Begin VB.MDIForm MDIForm1 BackColor = &H8000000C& Caption = "Document Editor" ClientHeight = 3195 ClientLeft = 165 ClientTop = 735 ClientWidth = 4680 LinkTopic = "MDIForm1" LockControls = -1 'True StartUpPosition = 3 'Windows Default WindowState = 2 'Maximized Begin ComctlLib.Toolbar Toolbar1 Align = 1 'Align Top Height = 1035 Left = 0 TabIndex = 0 Top = 0 Width = 4680 _ExtentX = 8255 _ExtentY = 1826 ButtonWidth = 609 ButtonHeight = 556 AllowCustomize = 0 'False Appearance = 1 ImageList = "ImageList1" _Version = 327682 BeginProperty Buttons {0713E452-850A-101B-AFC0-4210102A8DA7} NumButtons = 46 BeginProperty Button1 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.ToolTipText = "New" Object.Tag = "" ImageIndex = 1 EndProperty BeginProperty Button2 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.ToolTipText = "Open" Object.Tag = "" ImageIndex = 2 EndProperty BeginProperty Button3 {0713F354-850A-101B-AFC0-4210102A8DA7} Enabled = 0 'False Object.ToolTipText = "Save" Object.Tag = "" ImageIndex = 3 EndProperty BeginProperty Button4 {0713F354-850A-101B-AFC0-4210102A8DA7} Enabled = 0 'False Object.ToolTipText = "Save As" Object.Tag = "" ImageIndex = 4 EndProperty BeginProperty Button5 {0713F354-850A-101B-AFC0-4210102A8DA7} Enabled = 0 'False Object.ToolTipText = "Delete" Object.Tag = "" ImageIndex = 5 EndProperty BeginProperty Button6 {0713F354-850A-101B-AFC0-4210102A8DA7} Enabled = 0 'False Object.ToolTipText = "Print" Object.Tag = "" ImageIndex = 6 EndProperty BeginProperty Button7 {0713F354-850A-101B-AFC0-4210102A8DA7} Enabled = 0 'False Object.ToolTipText = "Print Preview" Object.Tag = "" ImageIndex = 7 EndProperty BeginProperty Button8 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.ToolTipText = "Close" Object.Tag = "" ImageIndex = 8 EndProperty BeginProperty Button9 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Visible = 0 'False Object.Tag = "" Style = 4 Object.Width = 130 MixedState = -1 'True EndProperty BeginProperty Button10 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Visible = 0 'False Object.Tag = "" Style = 4 Object.Width = 130 MixedState = -1 'True EndProperty BeginProperty Button11 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Tag = "" Style = 4 Object.Width = 240 MixedState = -1 'True EndProperty BeginProperty Button12 {0713F354-850A-101B-AFC0-4210102A8DA7} Enabled = 0 'False Object.ToolTipText = "Cut" Object.Tag = "" ImageIndex = 9 EndProperty BeginProperty Button13 {0713F354-850A-101B-AFC0-4210102A8DA7} Enabled = 0 'False Object.ToolTipText = "Copy" Object.Tag = "" ImageIndex = 10 EndProperty BeginProperty Button14 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.ToolTipText = "Paste" Object.Tag = "" ImageIndex = 11 EndProperty BeginProperty Button15 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Tag = "" Style = 4 Object.Width = 400 MixedState = -1 'True EndProperty BeginProperty Button16 {0713F354-850A-101B-AFC0-4210102A8DA7} Enabled = 0 'False Object.ToolTipText = "Spell Checker" Object.Tag = "" ImageIndex = 21 Object.Width = 130 MixedState = -1 'True EndProperty BeginProperty Button17 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Tag = "" Style = 4 Object.Width = 400 MixedState = -1 'True EndProperty BeginProperty Button18 {0713F354-850A-101B-AFC0-4210102A8DA7} Enabled = 0 'False Object.ToolTipText = "Find" Object.Tag = "" ImageIndex = 12 EndProperty BeginProperty Button19 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Visible = 0 'False Object.Tag = "" Style = 4 Object.Width = 130 MixedState = -1 'True EndProperty BeginProperty Button20 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Visible = 0 'False Object.Tag = "" Style = 4 Object.Width = 130 MixedState = -1 'True EndProperty BeginProperty Button21 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Tag = "" Style = 4 Object.Width = 240 MixedState = -1 'True EndProperty BeginProperty Button22 {0713F354-850A-101B-AFC0-4210102A8DA7} Enabled = 0 'False Object.ToolTipText = "Bold" Object.Tag = "" ImageIndex = 13 EndProperty BeginProperty Button23 {0713F354-850A-101B-AFC0-4210102A8DA7} Enabled = 0 'False Object.ToolTipText = "Italic" Object.Tag = "" ImageIndex = 14 EndProperty BeginProperty Button24 {0713F354-850A-101B-AFC0-4210102A8DA7} Enabled = 0 'False Object.ToolTipText = "Underline" Object.Tag = "" ImageIndex = 15 EndProperty BeginProperty Button25 {0713F354-850A-101B-AFC0-4210102A8DA7} Enabled = 0 'False Object.ToolTipText = "Strikethru" Object.Tag = "" ImageIndex = 16 EndProperty BeginProperty Button26 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Visible = 0 'False Object.Tag = "" Style = 4 Object.Width = 130 MixedState = -1 'True EndProperty BeginProperty Button27 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Visible = 0 'False Object.Tag = "" Style = 4 Object.Width = 130 MixedState = -1 'True EndProperty BeginProperty Button28 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Tag = "" Style = 4 Object.Width = 240 MixedState = -1 'True EndProperty BeginProperty Button29 {0713F354-850A-101B-AFC0-4210102A8DA7} Enabled = 0 'False Object.ToolTipText = "Left" Object.Tag = "" ImageIndex = 17 Style = 2 EndProperty BeginProperty Button30 {0713F354-850A-101B-AFC0-4210102A8DA7} Enabled = 0 'False Object.ToolTipText = "Center" Object.Tag = "" ImageIndex = 18 Style = 2 EndProperty BeginProperty Button31 {0713F354-850A-101B-AFC0-4210102A8DA7} Enabled = 0 'False Object.ToolTipText = "Right" Object.Tag = "" ImageIndex = 19 Style = 2 EndProperty BeginProperty Button32 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Tag = "" Style = 4 Object.Width = 1700 MixedState = -1 'True EndProperty BeginProperty Button33 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Visible = 0 'False Object.Tag = "" MixedState = -1 'True EndProperty BeginProperty Button34 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Visible = 0 'False Object.Tag = "" MixedState = -1 'True EndProperty BeginProperty Button35 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Visible = 0 'False Object.Tag = "" MixedState = -1 'True EndProperty BeginProperty Button36 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Visible = 0 'False Object.Tag = "" Object.Width = 200 MixedState = -1 'True EndProperty BeginProperty Button37 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Visible = 0 'False Object.Tag = "" Object.Width = 200 MixedState = -1 'True EndProperty BeginProperty Button38 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Visible = 0 'False Object.Tag = "" Object.Width = 200 MixedState = -1 'True EndProperty BeginProperty Button39 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Visible = 0 'False Object.Tag = "" MixedState = -1 'True EndProperty BeginProperty Button40 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Visible = 0 'False Object.Tag = "" MixedState = -1 'True EndProperty BeginProperty Button41 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Visible = 0 'False Object.Tag = "" MixedState = -1 'True EndProperty BeginProperty Button42 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Visible = 0 'False Object.Tag = "" Style = 4 Object.Width = 2000 MixedState = -1 'True EndProperty BeginProperty Button43 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Visible = 0 'False Object.Tag = "" Style = 4 MixedState = -1 'True EndProperty BeginProperty Button44 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Visible = 0 'False Object.Tag = "" MixedState = -1 'True EndProperty BeginProperty Button45 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.Visible = 0 'False Object.Tag = "" MixedState = -1 'True EndProperty BeginProperty Button46 {0713F354-850A-101B-AFC0-4210102A8DA7} Object.ToolTipText = "Exit" Object.Tag = "" ImageIndex = 20 EndProperty EndProperty Begin VB.ComboBox Combo2 Height = 315 Left = 8760 TabIndex = 2 Top = 0 Width = 1110 End End Begin MSComDlg.CommonDialog CommonDialog4 Left = 2520 Top = 480 _ExtentX = 847 _ExtentY = 847 _Version = 327681 End Begin ComctlLib.StatusBar StatusBar2 Align = 2 'Align Bottom Height = 330 Left = 0 TabIndex = 3 Top = 2535 Visible = 0 'False Width = 4680 _ExtentX = 8255 _ExtentY = 582 SimpleText = "" _Version = 327682 BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} NumPanels = 1 BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} Object.Width = 10231 MinWidth = 10231 TextSave = "" Object.Tag = "" EndProperty EndProperty End Begin MSComDlg.CommonDialog CommonDialog3 Left = 1920 Top = 480 _ExtentX = 847 _ExtentY = 847 _Version = 327681 CancelError = -1 'True End Begin MSComDlg.CommonDialog CommonDialog2 Left = 1320 Top = 480 _ExtentX = 847 _ExtentY = 847 _Version = 327681 CancelError = -1 'True DialogTitle = "Save Document" Filter = "Text Files|*.txt" InitDir = "C:\Windows" End Begin MSComDlg.CommonDialog CommonDialog1 Left = 720 Top = 480 _ExtentX = 847 _ExtentY = 847 _Version = 327681 CancelError = -1 'True DialogTitle = "Open Document" Filter = "Text Files"" & _""All Files (*.*)|*.*|" InitDir = "C:\Windows" End Begin ComctlLib.StatusBar StatusBar1 Align = 2 'Align Bottom Height = 330 Left = 0 TabIndex = 1 Top = 2865 Width = 4680 _ExtentX = 8255 _ExtentY = 582 SimpleText = "" _Version = 327682 BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} NumPanels = 8 BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} AutoSize = 1 Object.Width = 8784 MinWidth = 8784 TextSave = "" Object.Tag = "" EndProperty BeginProperty Panel2 {0713E89F-850A-101B-AFC0-4210102A8DA7} Object.Width = 1499 MinWidth = 1499 Object.Tag = "" EndProperty BeginProperty Panel3 {0713E89F-850A-101B-AFC0-4210102A8DA7} Object.Width = 970 MinWidth = 970 Text = "Line#" TextSave = "Line#" Object.Tag = "" EndProperty BeginProperty Panel4 {0713E89F-850A-101B-AFC0-4210102A8DA7} Object.Width = 1235 MinWidth = 1235 Object.Tag = "" EndProperty BeginProperty Panel5 {0713E89F-850A-101B-AFC0-4210102A8DA7} Style = 5 Object.Width = 1764 MinWidth = 1764 TextSave = "3:06 PM" Object.Tag = "" EndProperty BeginProperty Panel6 {0713E89F-850A-101B-AFC0-4210102A8DA7} Style = 6 Object.Width = 1764 MinWidth = 1764 TextSave = "09/10/1999" Object.Tag = "" EndProperty BeginProperty Panel7 {0713E89F-850A-101B-AFC0-4210102A8DA7} Style = 1 Enabled = 0 'False Object.Width = 2293 MinWidth = 2293 TextSave = "CAPS" Object.Tag = "" EndProperty BeginProperty Panel8 {0713E89F-850A-101B-AFC0-4210102A8DA7} Style = 2 Object.Width = 2293 MinWidth = 2293 TextSave = "NUM" Object.Tag = "" EndProperty EndProperty End Begin ComctlLib.ImageList ImageList1 Left = 120 Top = 480 _ExtentX = 1005 _ExtentY = 1005 BackColor = -2147483643 ImageWidth = 16 ImageHeight = 15 MaskColor = 12632256 _Version = 327682 BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} NumListImages = 22 BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "MDIForm1.frx":0000 Key = "" EndProperty BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "MDIForm1.frx":0542 Key = "" EndProperty BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "MDIForm1.frx":0A84 Key = "" EndProperty BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "MDIForm1.frx":0FC6 Key = "" EndProperty BeginProperty ListImage5 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "MDIForm1.frx":1508 Key = "" EndProperty BeginProperty ListImage6 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "MDIForm1.frx":161A Key = "" EndProperty BeginProperty ListImage7 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "MDIForm1.frx":1B5C Key = "" EndProperty BeginProperty ListImage8 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "MDIForm1.frx":209E Key = "" EndProperty BeginProperty ListImage9 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "MDIForm1.frx":23B8 Key = "" EndProperty BeginProperty ListImage10 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "MDIForm1.frx":2A32 Key = "" EndProperty BeginProperty ListImage11 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "MDIForm1.frx":2F74 Key = "" EndProperty BeginProperty ListImage12 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "MDIForm1.frx":34B6 Key = "" EndProperty BeginProperty ListImage13 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "MDIForm1.frx":35C8 Key = "" EndProperty BeginProperty ListImage14 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "MDIForm1.frx":36DA Key = "" EndProperty BeginProperty ListImage15 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "MDIForm1.frx":37EC Key = "" EndProperty BeginProperty ListImage16 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "MDIForm1.frx":38FE Key = "" EndProperty BeginProperty ListImage17 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "MDIForm1.frx":3A10 Key = "" EndProperty BeginProperty ListImage18 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "MDIForm1.frx":3B22 Key = "" EndProperty BeginProperty ListImage19 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "MDIForm1.frx":3C34 Key = "" EndProperty BeginProperty ListImage20 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "MDIForm1.frx":3D46 Key = "" EndProperty BeginProperty ListImage21 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "MDIForm1.frx":4060 Key = "" EndProperty BeginProperty ListImage22 {0713E8C3-850A-101B-AFC0-4210102A8DA7} Picture = "MDIForm1.frx":45A2 Key = "" EndProperty EndProperty End Begin VB.Menu mnuFile Caption = "&File" Begin VB.Menu mnuNew Caption = "&New" Shortcut = ^N End Begin VB.Menu mnuOpen Caption = "&Open" Shortcut = ^O End Begin VB.Menu mnuClose Caption = "&Close" End Begin VB.Menu mnu1 Caption = "-" End Begin VB.Menu mnuSave Caption = "&Save" Enabled = 0 'False Shortcut = ^S End Begin VB.Menu mnuSaveAs Caption = "&SaveAs" Enabled = 0 'False End Begin VB.Menu mnuDelete Caption = "&Delete" Enabled = 0 'False End Begin VB.Menu mnu2 Caption = "-" End Begin VB.Menu mnuPrintPreview Caption = "&Print Preview" Enabled = 0 'False End Begin VB.Menu mnuPrint Caption = "&Print" Enabled = 0 'False Shortcut = ^P End Begin VB.Menu mnu3 Caption = "-" End Begin VB.Menu mnuRun Caption = "&Run" End Begin VB.Menu mnuSep Caption = "-" End Begin VB.Menu mnuExit Caption = "&Exit" End End Begin VB.Menu mnuEdit Caption = "&Edit" Begin VB.Menu mnuUndo Caption = "&Undo" End Begin VB.Menu mnuCut Caption = "&Cut" Enabled = 0 'False Shortcut = ^X End Begin VB.Menu mnuCopy Caption = "C&opy" Enabled = 0 'False Shortcut = ^C End Begin VB.Menu mnuPaste Caption = "&Paste" End Begin VB.Menu mnu4 Caption = "-" End Begin VB.Menu mnuFind Caption = "&Find " Enabled = 0 'False Shortcut = ^F End Begin VB.Menu mnuReplace Caption = "R&eplace" Enabled = 0 'False End Begin VB.Menu mnuFindFiles Caption = "F&ind Files" End Begin VB.Menu mnu45 Caption = "-" End Begin VB.Menu mnuSelectAll Caption = "&Select All" End Begin VB.Menu mnuTimeDate Caption = "&Time/Date" End End Begin VB.Menu mnuView Caption = "&View" Begin VB.Menu mnuWordCount Caption = "&Word Count" Checked = -1 'True Enabled = 0 'False End Begin VB.Menu mnu7 Caption = "-" End Begin VB.Menu mnuToolbar Caption = "&Toolbar" Checked = -1 'True End Begin VB.Menu mnuStatusBar Caption = "&Status Bar" Checked = -1 'True End End Begin VB.Menu mnuFormat Caption = "F&ormat" Enabled = 0 'False Visible = 0 'False Begin VB.Menu mnuFormatText Caption = "&Text" Enabled = 0 'False End End Begin VB.Menu mnuTools Caption = "&Tools" Begin VB.Menu mnuSpelling Caption = "&Spelling" Enabled = 0 'False End End Begin VB.Menu mnuWindow Caption = "&Window" WindowList = -1 'True Begin VB.Menu mnuCascade Caption = "&Cascade" End Begin VB.Menu mnuTile Caption = "&Tile" End End Begin VB.Menu mnuHelp Caption = "&Help" Begin VB.Menu mnuVBContents Caption = "&VB Contents" End Begin VB.Menu mnu5 Caption = "-" End Begin VB.Menu mnuAboutDocument Caption = "&About Document" Shortcut = {F1} End End Attribute VB_Name = "MDIForm1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Private Const SW_SHOWNORMAL = 1 Private Const SW_SHOWMINIMIZED = 2 Private Const SW_SHOWMAXIMIZED = 3 Private Const SW_SHOW = 5 Private Const SW_MINIMIZE = 6 Private Const SW_SHOWMINNOACTIVE = 7 Private Const SW_SHOWNA = 8 Private Const SW_RESTORE = 9 Private Const SW_SHOWDEFAULT = 10 Private Declare Function sendmessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wmsg As Long, ByVal wparam As Integer, ByVal lparam As Long) As Long Private Sub SetToolBarFlat(tlbTemp As Toolbar) Dim lngStyle As Long Dim lngResult As Long Dim lngHWND As Long lngHWND = FindWindowEx(tlbTemp.hwnd, 0&, "ToolbarWindow32", vbNullString) lngStyle = sendmessage(lngHWND, TB_GETSTYLE, &O0, &O0) lngStyle = lngStyle Or TBSTYLE_FLAT lngResult = sendmessage(lngHWND, TB_SETSTYLE, 0, lngStyle) tlbTemp.Refresh End Sub Private Sub Combo2_Click() On Error GoTo ErrorTrap frmOpenDoc.RichTextBox1.SelFontSize = Combo2 boolsave = True Me.mnuSaveAs.Enabled = True Me.Toolbar1.Buttons(4).Enabled = True frmOpenDoc.SetFocus Exit Sub ErrorTrap: Call ErrorTrap boolsave = False ControlsDisabled End Sub Private Sub MDIForm_Load() On Error GoTo FindError Call CheckSoftware(MDIForm1) Call SetToolBarFlat(Toolbar1) frmOpenDoc.RichTextBox1.SetFocus StatusBar1.Panels(1).Text = "Create a new Document" StatusBar1.Panels(2).Text = User1 boolnew = True CommonDialog1.Filter = "All Files (*.*)| *.*|Text Files" & _ "(*.txt)| *.txt|" mnuWordCount.Checked = False With Combo2 .AddItem "8" .AddItem "10" .AddItem "12" .AddItem "14" .AddItem "16" .AddItem "18" .AddItem "20" .AddItem "22" .AddItem "36" .AddItem "72" .ListIndex = 0 .ZOrder End With boolsave = False Exit Sub FindError: Call ErrorTrap End Sub Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer) If boolnew = True And boolsave = True Then Response = MsgBox(" Do You Want To Save Changes?", vbQuestion + vbYesNoCancel) Me.CommonDialog2.CancelError = True On Error GoTo ErrHandler Select Case Response Case vbYes On Error GoTo ErrHandler Me.CommonDialog2.Flags = &H2 'File exists Me.CommonDialog2.ShowSave frmOpenDoc.RichTextBox1.SaveFile Me.CommonDialog2.filename boolsave = False Exit Sub Case vbNo End Select If boolsave = True Then Response = MsgBox(" Do You Want To Save Changes?", vbQuestion + vbYesNoCancel) Me.CommonDialog2.CancelError = True On Error GoTo ErrHandler Select Case Response Case vbYes Call SaveDoc If bCannotSave = False Then End If Case vbNo End Select End If End If ErrHandler: Cancel = True End Sub Private Sub mnuAboutDocument_Click() frmAbout1.Show 1 End Sub Private Sub mnuCascade_Click() Me.Arrange Cascade End Sub Private Sub mnuClose_Click() Call CloseFile End Sub Private Sub mnuCopy_Click() Call Copy End Sub Private Sub mnuCut_Click() Call Cut End Sub Private Sub mnuDelete_Click() Call Recycle End Sub Private Sub mnuExit_Click() Call DocUnload End Sub Private Sub mnuFind_Click() frmFind.Show End Sub Private Sub mnuFindFiles_Click() Screen.MousePointer = 11 Dim strPathToSearch As String strPathToSearch = "C:\" Call ShellExecute(Me.hwnd, "find", strPathtoString, vbNullString, vbNullString, SW_SHOWNORMAL) Screen.MousePointer = 0 End Sub Private Sub mnuFormatText_Click() frmFormatText.Show 1 End Sub Private Sub mnuNew_Click() 'Dim NewChild As New frmOpenDoc 'NewChild.Show On Error GoTo FindError: If boolnew = True And boolsave = True Then Call NewModExisting If boolsave = True Then Call CloseModExistNewDoc If bCannotSave = False Then boolnew = True End If Call ControlsDisabled Me.mnuTimeDate.Enabled = True Combo2.Enabled = True With frmOpenDoc .Visible = True .RichTextBox1.Visible = True .RichTextBox1.Enabled = True .WindowState = 0 .Width = Screen.Width * 0.89 ' Set width of form. .Height = Screen.Height * 0.61 ' Set height of form. .Left = (Screen.Width - Width) / 19.5 ' Center form horizontally. .Top = (Screen.Height - Height) / 20 ' Center form vertically. .Caption = "New Document" .SetFocus End With StatusBar1.Panels(1).Text = "Create a new Document" Me.mnuPaste.Enabled = True: Me.Toolbar1.Buttons(14).Enabled = True boolnew = True End If End If Exit Sub FindError: Call ErrorTrap End Sub Private Sub mnuOpen_Click() Call OpenFile End Sub Private Sub mnuPaste_Click() Call Paste End Sub Private Sub mnuPrint_Click() Call PrintDoc End Sub Private Sub mnuPrintPreview_Click() frmPreview.Show 1 End Sub Private Sub mnuReplace_Click() frmReplace.Show End Sub Private Sub mnuRun_Click() frmRun.Show End Sub Private Sub mnuSave_Click() Call SaveDoc End Sub Private Sub mnuSaveAs_Click() Call SaveAs End Sub Private Sub mnuSelectAll_Click() With frmOpenDoc.RichTextBox1 .SelStart = 0 .SelLength = Len(frmOpenDoc.RichTextBox1.Text) .SetFocus End With End Sub Private Sub mnuSpelling_Click() Call Spelling End Sub Private Sub mnuStatusBar_Click() If mnuStatusBar.Checked = False Then StatusBar1.Visible = True StatusBar1.Visible = False End If mnuStatusBar.Checked = Not mnuStatusBar.Checked End Sub Private Sub mnuTile_Click() Me.Arrange TILE_HORIZONTAL End Sub Private Sub mnuTimeDate_Click() Call RichTextKeyDown frmOpenDoc.RichTextBox1.SelText = Now boolsave = True If boolnew = True And boolsave = True Then Me.mnuSaveAs.Enabled = True Me.Toolbar1.Buttons(4).Enabled = True Me.mnuSaveAs.Enabled = True Me.Toolbar1.Buttons(4).Enabled = True Me.mnuSave.Enabled = True Me.Toolbar1.Buttons(3).Enabled = True End If End Sub Private Sub mnuToolbar_Click() If mnuToolbar.Checked = False Then Toolbar1.Visible = True Toolbar1.Visible = False End If mnuToolbar.Checked = Not mnuToolbar.Checked End Sub Private Sub mnuUndo_Click() Dim OK As Long OK = sendmessage(Screen.ActiveForm.ActiveControl.hwnd, EM_UNDO, 0&, 0&) End Sub Private Sub mnuVBContents_Click() Screen.MousePointer = vbArrowQuestion CommonDialog4.HelpFile = "VB5.HLP" CommonDialog4.HelpCommand = cdlHelpContents CommonDialog4.ShowHelp Screen.MousePointer = 0 End Sub Private Sub mnuWordCount_Click() If frmOpenDoc.RichTextBox1.Text = "" Then Exit Sub End If Screen.MousePointer = 11 StatusBar1.Panels(1).Text = "Loading word count, please wait..." On Error GoTo ErrorTrap: 'Dim WordCount As Object, dlg As Object If mnuWordCount.Checked = False Then Set wordcontact = CreateObject("Word.basic") Clipboard.Clear Clipboard.SetText frmOpenDoc.RichTextBox1.Text, 1 wordcontact.FileNewDefault wordcontact.EditPaste wordcontact.ToolsWordCount Set dlg = wordcontact.curvalues.ToolsWordCount StatusBar2.Visible = True c = dlg.characters w = dlg.words p = dlg.paragraphs cr = Chr(13) n = "Characters = " & c n = n & " Words = " & w n = n & " Paragraphs = " & p StatusBar2.Panels(1) = n wordcontact.FileExit 2 Set wordcontact = Nothing StatusBar2.Visible = False End If mnuWordCount.Checked = Not mnuWordCount.Checked If boolnew = True Then StatusBar1.Panels(1) = CommonDialog2.filename StatusBar1.Panels(1) = CommonDialog1.filename End If Screen.MousePointer = 0 Exit Sub ErrorTrap: Call ErrorTrap Screen.MousePointer = 0 If boolnew = True Then StatusBar1.Panels(1) = CommonDialog2.filename StatusBar1.Panels(1) = CommonDialog1.filename End If Set wordcontact = Nothing End Sub Private Sub Toolbar1_ButtonClick(ByVal Button As ComctlLib.Button) Select Case Button.Index Case 1: Call mnuNew_Click Case 2: Call OpenFile Case 3: Call SaveDoc Case 4: Call SaveAs Case 5: Call Recycle Case 6: Call PrintDoc Case 7: frmPreview.Show 1 Case 8: Call CloseFile Case 12: Call Cut Case 13: Call Copy Case 14: Call Paste Case 16: Call Spelling Case 18: frmFind.Show Case 22 If frmOpenDoc.RichTextBox1.SelBold = True Then frmOpenDoc.RichTextBox1.SelBold = False Toolbar1.Buttons(22).Value = 0 SaveEnabled frmOpenDoc.RichTextBox1.SelBold = True Toolbar1.Buttons(22).Value = 1 boolsave = True SaveEnabled End If Case 23 If frmOpenDoc.RichTextBox1.SelItalic = True Then frmOpenDoc.RichTextBox1.SelItalic = False Toolbar1.Buttons(23).Value = 0 SaveEnabled frmOpenDoc.RichTextBox1.SelItalic = True Toolbar1.Buttons(23).Value = 1 boolsave = True SaveEnabled End If Case 24 If frmOpenDoc.RichTextBox1.SelUnderline = True Then frmOpenDoc.RichTextBox1.SelUnderline = False Toolbar1.Buttons(24).Value = 0 SaveEnabled frmOpenDoc.RichTextBox1.SelUnderline = True Toolbar1.Buttons(24).Value = 1 boolsave = True SaveEnabled End If Case 25 If frmOpenDoc.RichTextBox1.SelStrikeThru = True Then frmOpenDoc.RichTextBox1.SelStrikeThru = False Toolbar1.Buttons(25).Value = 0 SaveEnabled frmOpenDoc.RichTextBox1.SelStrikeThru = True Toolbar1.Buttons(25).Value = 1 boolsave = True SaveEnabled End If Case 29 frmOpenDoc.RichTextBox1.SelAlignment = 0 boolsave = True SaveEnabled Case 30 frmOpenDoc.RichTextBox1.SelAlignment = 2 boolsave = True SaveEnabled Case 31 frmOpenDoc.RichTextBox1.SelAlignment = 1 boolsave = True SaveEnabled Case 46: Call DocUnload End Select End Sub Private Sub Cut() Clipboard.Clear Clipboard.SetText frmOpenDoc.RichTextBox1.SelText frmOpenDoc.RichTextBox1.SelText = "" boolsave = True Call SaveEnabled End Sub Private Sub Copy() Clipboard.Clear Clipboard.SetText frmOpenDoc.RichTextBox1.SelText Call SaveEnabled End Sub Private Sub Paste() frmOpenDoc.RichTextBox1.SelText = Clipboard.GetText() If frmOpenDoc.RichTextBox1.Text <> "" Then boolsave = True Call SaveEnabled Call ControlsEnabled End If End Sub Private Sub Recycle() Dim op As SHFILEOPSTRUCT If boolnew = True Then With op .wFunc = FO_DELETE .pFrom = CommonDialog2.filename .fFlags = FOF_ALLOWUNDO End With SHFileOperation op frmOpenDoc.Visible = False Call ControlsDisabled With op .wFunc = FO_DELETE .pFrom = CommonDialog1.filename .fFlags = FOF_ALLOWUNDO End With SHFileOperation op frmOpenDoc.Visible = False Call ControlsDisabled End If End Sub